fn main() {
    fn get_vec() -> Vec<i32> {
        vec![3, 1, 2]
    }

    {
        let data = {
            let mut data = get_vec();
            data.sort();

            data
        };

        // Here `data` is immutable.
        assert_eq!(vec![1, 2, 3], data);
    }

    {
        let mut data = get_vec();
        data.sort();
        let data = data;

        // Here `data` is immutable.
        assert_eq!(vec![1, 2, 3], data);
    }
}
